<!doctype html>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/_mozilla/bluetooth/bluetooth-helpers.js"></script>
<script>
'use strict';
promise_test(() => {
    window.testRunner.setBluetoothMockDataSet(adapter_type.glucose_heart_rate);
    return Promise.all([
        window.navigator.bluetooth.requestDevice({
            filters: [{
                manufacturerData: {
                    17: {}
                }
            }]
        }),
        window.navigator.bluetooth.requestDevice({
            filters: [{
                manufacturerData: {
                    '17': {}
                }
            }]
        }),
        window.navigator.bluetooth.requestDevice({
            filters: [{
                serviceData: {
                    'glucose': {}
                }
            }]
        }),
        window.navigator.bluetooth.requestDevice({
            filters: [{
                serviceData: {
                    '00001808-0000-1000-8000-00805f9b34fb': {}
                }
            }]
        }),
        window.navigator.bluetooth.requestDevice({
            filters: [{
                serviceData: {
                    0x1808: {}
                }
            }]
        })
    ])
    .then(devices => {
        devices.forEach(device => assert_equals(device.name, mock_device_name.glucose));
    });
}, 'Only using the correct service/manufacturerData key, a device can be found.');
</script>
